
<%@ page import="coop.bancocredicoop.proyectos.gd.DocumentType" %>
<%@ page import="coop.bancocredicoop.proyectos.gd.FileType" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'documentType.label', default: 'DocumentType')}" />
		<title><g:message code="documentType.list.label" /></title>
        <script type="text/javascript">

        function changePage() {
            $("#pagerForm").submit();
        }

        function cambiarPagina(pageOffset) {
            pageOffset = pageOffset >= 0 ? pageOffset : 0;
            $("#offset").val(pageOffset)
            changePage();
            return false
        }

        </script>

	</head>
      <body>
        <div class="container">
        <div class="main-panel">
        <div class="panel panel-default">
        <div class="panel-heading">
            <h2><g:message code="documentType.list.label" /></h2>
            <a class="btn btn-default btn-sm" href="${createLink(action: 'create')}">
                <span class="glyphicon glyphicon-plus"></span> Agregar
            </a>
        </div>
        <div class="panel-body">
        
        <g:if test="${flash.success}">
        <div class="alert alert-success">${flash.message}</div> 
        </g:if>
        <g:elseif test="${flash.message}">
        <div class="alert alert-danger">${flash.message}</div> 
        </g:elseif>

        <table class="table table-hover">
            <thead>
                <tr>
                  <th>Nombre</th>
                  <th style="text-align: center;"><g:message code="documentType.purgeable.label" /></th>
                  <th style="text-align: center;"><g:message code="documentType.hasExpiration.label" /></th>
                </tr>
            </thead>
            <tbody>
            <g:each in="${documentTypeInstanceList}" var="documentTypeInstance">
                <tr>
                    <td><g:link action="show" id="${documentTypeInstance.id}">${documentTypeInstance.name}</g:link></td>
                    <td style="text-align: center;"><g:formatBoolean boolean="${documentTypeInstance.purgeable}" true="Sí" false="No" /></td>

                    <td style="text-align: center;"><g:formatBoolean boolean="${documentTypeInstance.hasExpiration}" true="Sí" false="No" /></td>
                </tr>
            </g:each>
            </tbody>
        </table>

        <form id="pagerForm" method="GET">
            <input type="hidden" id="offset" name="offset" />
        </form>
        <g:render template="/shared/pagination" 
                  model="[itemPerPage: itemsPerPage, offset: offset, totalItems: documentTypeInstanceCount, changeOffsetFunction: 'cambiarPagina']" />

        </div>
        </div>
        </div>
        </div>
      </body>
</html>